import formula.Formula;
import proof.Proof;
import proof.ProofRule;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;

public class UsedCondition {
    HashSet<UCWithRuleName> usedConditions;

    UsedCondition(){
        usedConditions=new HashSet<UCWithRuleName>();
    }

    public void add(ArrayList<Proof> conditions, ProofRule ruleName){
        usedConditions.add(new UCWithRuleName(conditions,ruleName));
    }

    public boolean contain(ArrayList<Proof> conditions,ProofRule ruleName){
        UCWithRuleName uc=new UCWithRuleName(conditions,ruleName);
        return usedConditions.contains(uc);
//        for (UCWithRuleName usedCondition:usedConditions) {
//            if (usedCondition.equals(uc)){
//                return true;
//            }
//        }
//        return false;
    }

    @Override
    public String toString(){
        StringBuilder ret = new StringBuilder();
        ret.append("Used Condition:\n");
        for (var uc :  usedConditions) {
//            for (var condition : uc) {
//                ret.append(condition).append(",");
//            }
            String condition=uc.usedConditions.toString();
            String ruleName=uc.ruleName.toString();
            ret.append(condition).append(",").append(ruleName).append(",");
            //ret.append("\n");
        }
        ret.append("\n");
        return ret.toString();
    }


//    @Override
//    public String toString() {
//        return "UsedCondition{" +
//                "usedConditions=" + usedConditions +
//                '}';
//    }
}
